package myschool.test4;

import myschool.dao.StudentDao;
import myschool.entity.Student;
import myschool.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author oldliu
 * @since 1.0
 */
public class TestUpdate {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
        Date b=df.parse("1999-2-6");
        SqlSession s= MyBatisUtil.get();
        StudentDao mapper=s.getMapper(StudentDao.class);
        Student stu=new Student();

        stu.setSname("高于要");
        stu.setQq("44322ss");
        stu.setGradeid(6);
        stu.setTelephone("14744423423432");
        stu.setBirthday(b);
        mapper.add(stu);
        System.out.println("new stuno:"+stu.getStuno());
        MyBatisUtil.close(s);
    }
}
